package com.example.controller;

import com.example.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@Controller
public class HelloController {

    @PostMapping("login")
    @ResponseBody
    public Map login(@RequestBody User user) {
        System.out.println(user);
        Map map = new HashMap<String, Object>();
        if("tom".equals(user.getUsername()) && "123".equals(user.getPassword()))
        {
            map.put("success", true);
            map.put("message", "登录成功");
        }
        else {
            map.put("success", false);
            map.put("message", "登录失败，请检查用户名和密码是否输入正确");
        }
        return map;
    }


}
